package com.l024.meet.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.l024.framework.adapter.CloudTagAdapter;
import com.l024.framework.base.BaseFragment;
import com.l024.meet.R;
import com.l024.meet.ui.AddFriendActivity;
import com.moxun.tagcloudlib.view.TagCloudView;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author wu_ming_zhi_bei
 * @Date 2020/3/1 10:29
 * @Notes 星球
 */
public class StartFragment extends BaseFragment implements View.OnClickListener {

    private TextView tvStarTitle;
    private ImageView ivCamera;
    private ImageView ivAdd;
    private TextView tvConnectStatus;
    private TagCloudView mCloudView;
    private LinearLayout llRandom;
    private TextView tvRandom;
    private LinearLayout llSoul;
    private TextView tvSoul;
    private LinearLayout llFate;
    private TextView tvFate;
    private LinearLayout llLove;
    private TextView tvLove;

    private List<String> mStarList = new ArrayList<>();
    private CloudTagAdapter cloudTagAdapter;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_start, null);
        initView(view);
        return view;
    }

    private void initView(View view) {
        tvStarTitle = (TextView) view.findViewById(R.id.tv_star_title);
        ivCamera = (ImageView) view.findViewById(R.id.iv_camera);
        ivAdd = (ImageView) view.findViewById(R.id.iv_add);
        ivAdd.setOnClickListener(this);
        tvConnectStatus = (TextView) view.findViewById(R.id.tv_connect_status);
        mCloudView = (TagCloudView) view.findViewById(R.id.mCloudView);
        llRandom = (LinearLayout) view.findViewById(R.id.ll_random);
        tvRandom = (TextView) view.findViewById(R.id.tv_random);
        llSoul = (LinearLayout) view.findViewById(R.id.ll_soul);
        tvSoul = (TextView) view.findViewById(R.id.tv_soul);
        llFate = (LinearLayout) view.findViewById(R.id.ll_fate);
        tvFate = (TextView) view.findViewById(R.id.tv_fate);
        llLove = (LinearLayout) view.findViewById(R.id.ll_love);
        tvLove = (TextView) view.findViewById(R.id.tv_love);

        for(int i=0;i<100;i++){
            mStarList.add("初见--"+i);
        }
        cloudTagAdapter = new CloudTagAdapter(getActivity(),mStarList);
        mCloudView.setAdapter(cloudTagAdapter);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_add:{
                startActivity(new Intent(getActivity(), AddFriendActivity.class));
                break;
            }
        }
    }
}
